<template>
	<view class="container">
		<addressSearchFixed ref="setAddres" @searchBtn='event_clickSearchBtn' placeholderName="搜索车系" :isShowAddress="false">
		</addressSearchFixed>
		<view class="series-list" v-for="(item,index) in seriesList" :key="index">
			<view class="s-name">{{item.name}}</view>
			<view class="s-list">
				<view @click="seriesClick(item,childItem)" class="list-item" v-for="(childItem,childIndex) in item.children" :key="childIndex">
					<view class="series-left">{{childItem.name}}</view>
					<view class="series-right">
						<text>{{childItem.number}}</text>
						<image src="@/static/fanhui.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
		<view v-if="seriesList.length == 0" class="empty">
		  <image src="@/static/empty.png"></image>
		</view>
	</view>
</template>

<script>
	import addressSearchFixed from "@/components/addressSearch/addressSearchFixed.vue";
	import { newsGetList } from '@/api/card.js'
	export default {
		components: {
			addressSearchFixed
		},
		data() {
			return {
				users_id: uni.getStorageSync("login").id,
				brand_name: '',
				seriesList:[],
				search: ''
			}
		},
		onLoad(option) {
			this.brand_id = option.id
			this.init()
		},
		methods: {
			init(){
				newsGetList({
					users_id: this.users_id,
					brand_id: this.brand_id,
					search: this.search
				}).then( res => {
					this.seriesList = res.data
				})
			},
			event_clickSearchBtn(content) {
			  this.search = content;
			  this.init()
			},
			seriesClick(item,childItem){
				uni.navigateTo({
					url: "/pages/home/newCar/newEnergy/newEnergylist?id=" + childItem.id,
				});
			}
		}
	}
</script>

<style>
	.header-class{
		top: 0 !important;
		background-color: #2d56c5 !important;
	}
</style>
<style lang="scss" scoped>
	.empty {
	  display: flex;
	  justify-content: center;
	  image {
	    margin-top: 360rpx;
	  }
	}
	.container{
		padding-top: 46px;
		background-color: #F7F8FA;
		.series-list{
			.s-name{
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #333333;
				padding: 12rpx 25rpx;
			}
			.s-list{
				.list-item{
					display: flex;
					align-items: center;
					justify-content: space-between;
					background-color: #fff;
					padding: 30rpx 25rpx;
					border-bottom: 1rpx solid #E6E6E6;
					&:last-child{
						border-bottom: none;
					}
					.series-left{
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #000000;
					}
					.series-right{
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 400;
						color: #999999;
						image{
							width: 14rpx;
							height: 16rpx;
							margin-left: 15rpx;
						}
					}
				}
			}
		}
	}

</style>
